package com.yfbao.poll.demo.model;

import java.util.Map;

/**
 * 轮询对象基类
 */
public abstract class  BasePoll {

    BasePoll(Map<String, Long> userMsgTypes, String userName, long timeoutTime, String tag,boolean isAsync) {
        this.userMsgTypes = userMsgTypes;
        this.createTime = System.currentTimeMillis();
        this.userName = userName;
        this.timeoutTime = timeoutTime;
        this.tag = tag;
        this.isAsync=isAsync;
    }

    final boolean isAsync;

    //web轮询的消息类型和最后对应的版本号，比如将{msg:[{type:msg1, id:001},{type:msg2,id:010}]}保存至下面map
    final Map<String, Long> userMsgTypes;


    final long createTime;
    //请求关联的用户
    final String userName;

    //版本号，方便后续升级时通过不同版本进行控制
    final String tag;

    //请求超时时长
    final long timeoutTime;

    public boolean isAsync() {
        return isAsync;
    }

    public Map<String, Long> getUserMsgTypes() {
        return userMsgTypes;
    }

    public long getCreateTime() {
        return createTime;
    }

    public String getUserName() {
        return userName;
    }

    public String getTag() {
        return tag;
    }

    public long getTimeoutTime() {
        return timeoutTime;
    }

}
